-
Notifications
You must be signed in to change notification settings - Fork 113
SES time zone #135
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SES time zone #135
Conversation
Sometimes common header date comes with an alphabetical timezone in brackets after the numeric timezone
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @adam-fowler, I think this is a great addition. Would you mind adding a code comment, where we do the split of?
let bracket = string.firstIndex(of: "(") ?? string.endIndex | ||
let dateString = String(string[string.startIndex ..< bracket]) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would love to see a comment here why we are doing this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could we potentially save an allocation by making the string a var and rewriting it only if we find a bracket?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
both of them are done
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
orthogonal to these changes but we should add a link to SES event from https://github.com/swift-server/swift-aws-lambda-runtime#integration-with-aws-platform-events
Added the link in |
thanks @adam-fowler |
Support decoding time zones in the following format
Fri, 26 Jun 2020 03:04:03 -0500 (CDT)
Motivation:
Currently if an email is received with the common header date which includes the timezone in alphabetical form in brackets after the numeric timezone the date does not decode, and SES.Event does not decode.
Modifications:
Code changes include cropping text after any open bracket found in the date string before passing it through the dateFormatter. I don't know of a dataFormat string that will support the above format. If there is one obviously it would be better to use that instead.
Result:
SES.Event decodes even when it holds a date in the above format